package com.bydq.patrolsystem.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bydq.patrolsystem.entity.PsUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 写代码是不可能写代码的啦~~
 * @since 2020-05-22
 */
@Mapper
@Repository   //不加这个装配的时候会报红
public interface PsUserMapper extends BaseMapper<PsUser> {
                                                //这里的userCode就是用户名
    @Select("select userPassword from ps_user where userCode = #{username}")
    String selectPasswordByUsername(String username);


    void ordinaryUpdateByUserCode(PsUser user);

    @Update("update ps_user set userStatus = #{start} where id = #{id}")
    boolean updateStatus(@Param("id") Integer id,@Param("start") Integer start);

    @Select("select userStatus from ps_user where userCode = #{username}")
    int selectStatusByUserCode(String username);
}
